﻿using System.Threading;
using System.Threading.Tasks;

namespace YFurion.Application
{
    /// <summary>
    ///  方法包括：CURD、获取全部、分页获取 
    /// </summary>
    /// <typeparam name="TEntityDto"></typeparam>
    /// <typeparam name="TKey"></typeparam>
    /// <typeparam name="TGetAllInput"></typeparam>
    public interface IApplicationService<TEntityDto, TKey, in TGetAllInput> : IApplicationService<TEntityDto, TKey, TGetAllInput, TEntityDto, TEntityDto>
        where TEntityDto : class, IEntityDto<TKey>
    {
    }

    /// <summary>
    ///  方法包括：CURD、获取全部、分页获取 
    /// </summary>
    /// <typeparam name="TEntityDto"></typeparam>
    /// <typeparam name="TKey"></typeparam>
    /// <typeparam name="TGetAllInput"></typeparam>
    /// <typeparam name="TCreateInputDto"></typeparam>
    public interface IApplicationService<TEntityDto, TKey, in TGetAllInput, in TCreateInputDto> : IApplicationService<TEntityDto, TKey, TGetAllInput, TCreateInputDto, TCreateInputDto>
        where TEntityDto : class, IEntityDto<TKey>
        where TCreateInputDto : class, IEntityDto<TKey>
    {
    }

    /// <summary>
    /// 方法包括：CURD、获取全部、分页获取 
    /// </summary>
    /// <typeparam name="TEntityDto"></typeparam>
    /// <typeparam name="TKey"></typeparam>
    /// <typeparam name="TGetAllInput"></typeparam>
    /// <typeparam name="TCreateInputDto"></typeparam>
    /// <typeparam name="TUpdateInputDto"></typeparam>
    public interface IApplicationService<TEntityDto, TKey, in TGetAllInput, in TCreateInputDto, in TUpdateInputDto>
        where TEntityDto : class, IEntityDto<TKey>
        where TCreateInputDto : class, IEntityDto<TKey>
        where TUpdateInputDto : class, IEntityDto<TKey>
    {
        /// <summary>
        /// 根据id查询一条
        /// </summary>
        /// <param name="id"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<TEntityDto> Get(TKey id, CancellationToken cancellationToken = default);
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="input"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<PagedResultDto<TEntityDto>> GetAll(TGetAllInput input, CancellationToken cancellationToken = default);
        /// <summary>
        /// 新增一条
        /// </summary>
        /// <param name="input"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<TEntityDto> Post(TCreateInputDto input, CancellationToken cancellationToken = default);
        /// <summary>
        /// 更新一条
        /// </summary>
        /// <param name="input"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<TEntityDto> Put(TUpdateInputDto input, CancellationToken cancellationToken = default);
        /// <summary>
        /// 删除一条
        /// </summary>
        /// <param name="id"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task Delete(TKey id, CancellationToken cancellationToken = default);
    }
}
